package ai.people.netmon.telegram.domain.request.topic;

import ai.people.netmon.framework.businessenum.AnalysisSourceEnum;
import ai.people.netmon.framework.businessenum.AnalysisTypeEnum;
import ai.people.netmon.framework.domain.searchmsg.request.MessageRequest;
import ai.people.netmon.framework.model.request.PageKeyWordsRequest;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotNull;

/**
 * 相关信息请求
 *
 * @author yuanqinglong
 * @date 2022/1/14 18:01
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class RelatedMessageRequest extends PageKeyWordsRequest {

    /**
     * 主题id
     */
    @NotNull(message = "主题id不可为空")
    private Long topicId;

    /**
     * 开始日期
     */
    private String startDate;

    /**
     * 结束日期
     */
    private String endDate;

    /**
     * 源
     */
    private String source;


    /**
     * 创建消息请求
     *
     * @return {@link MessageRequest}
     */
    public MessageRequest createMessageRequest() {
        MessageRequest messageRequest = new MessageRequest();
        messageRequest.setSource(AnalysisSourceEnum.telegram.name());
        messageRequest.setAnalysisType(String.valueOf(AnalysisTypeEnum.TOPIC.getCode()));
        messageRequest.setSearchKeywords(getSearchKeywords());
        messageRequest.setOffset(getPageNo());
        messageRequest.setLimit(getPageSize());
        messageRequest.setStartDate(startDate);
        messageRequest.setEndDate(endDate);
        return messageRequest;
    }


}
